﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nuzzle.Database
{
    public static class DatabaseCache
    {
        public static List<Models.CharacterModel> CharactersCache { get; set; }
        public static List<Models.MapModel> MapCache { get; set; }

        public static int CHARACTER_NEXT_ID = 1;

        public static void Initialize()
        {
            Utilities.Logger.Load("Loading maps ...");
            MapCache = Models.MapModel.FindAll<Models.MapModel>();
            Utilities.Logger.Loaded("Loaded " + MapCache.Count + " maps !");

            Utilities.Logger.Load("Loading characters ...");
            CharactersCache = Models.CharacterModel.FindAll<Models.CharacterModel>();
            CharactersCache.OrderBy(x => x.ID);
            if (CharactersCache.Count > 0)  CHARACTER_NEXT_ID = CharactersCache.LastOrDefault().ID + 1;
            Utilities.Logger.Loaded("Loaded " + CharactersCache.Count + " characters !");
        }
    }
}
